Dear Doors Guru's, |
Re: recurring\re-use of DBE in dialog box
Put all the elements and their infos in skip lists, that you can use to access the elements in callbacks or from the scripts. I used the below code in a script, to do exactly the task you described (I put a button left of each text field and read from a config module). I hope it gives you the idea:
DBE lastDBE = null
int fieldCount = 0
Skip skFieldTabs = create()
int dialogHeight = 0;
void addField (string lab, string typ, string aName) {
DBE ed
AttrDef ad = find (mod, aName)
// last DBE remembers the last field that we added, so we can put the next one below it
// If we reach the ELEMENTS_PER_PAGE count, we will reset, so we can start a new page
if (fieldCount % ELEMENTS_PER_PAGE == 0) lastDBE = null
// Put a label
DBE dbeLb = label(modInfo, lab)
put (skFieldTabs, dbeLb, fieldCount / ELEMENTS_PER_PAGE)
// position it below the last one or at top of the tab
if (null lastDBE) dbeLb->"top"->"inside"->theTab else dbeLb->"top"->"spaced"->lastDBE
dbeLb->"left"->"inside"->theTab
// put a 'create' button in there if the attribute is not present
DBE bt
if (null ad) {
bt = button (modInfo, "Create", createAttr)
put (skFieldTabs, bt, fieldCount / ELEMENTS_PER_PAGE)
bt->"right"->"form"
bt->"left"->"unattached"
bt->"top"->"aligned"->dbeLb
}
// put a dummy label to get a nice space
DBE dummy = null
if (lower typ != "string") {
dummy = label (modInfo,"")
put (skFieldTabs, dummy, fieldCount / ELEMENTS_PER_PAGE)
dummy->"left"->"form"
dummy->"top"->"spaced"->dbeLb
}
// put the right kind of edit field, keep track of the dialog height ...
if lower typ == "richtext" then { ed = richText(modInfo, "", "test", 380,40,false); dialogHeight += 40; }
if lower typ == "text" then { ed = text(modInfo, "", "test", 380,40,false); dialogHeight += 40; }
if lower typ == "string" then { ed = field(modInfo, " ", "", 60); dialogHeight += 20; }
// store the field in the skip list
put (skFieldTabs, ed, fieldCount / ELEMENTS_PER_PAGE)
// position it
ed->"top"->"spaced"->dbeLb
if (null dummy) ed->"left"->"form" else ed->"left"->"spaced"->dummy
ed->"right"->"unattached"
// store it as the last DBE, so the next field will come below it
lastDBE = ed
// store the attribute and type names
put(skAttrs, ed, aName)
put(skType , ed, typ)
// associate the buttons with the edit fields, to get the right field in the callback
if (null ad) put (skButtons, bt, ed)
dialogHeight += 20
fieldCount++
}
...
// add the fields, they will
for x in childs(oAttributes) do {
addField ( x."Object Text" "", x."Variable Type" "", x."Variable Name" "")
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: recurring\re-use of DBE in dialog box Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: recurring\re-use of DBE in dialog box Your solution worked for me thanks to your hint. (I have developed a script for creating a dialog box to handle complex inputs to a doors module. XML file is used as a configuration file for complex input.) Do you think I should post the complete script here? But anyway, thanks a lot for your superfast help. Have a nice weekend, Ranjeetha |
Re: recurring\re-use of DBE in dialog box Ranjeetha - Fri Feb 04 01:44:46 EST 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |